
import { createRouter, createWebHashHistory } from "vue-router";
// export const Layout = () => import( "@/layout/index.vue" );

// 静态路由
export const constantRoutes = [
    // {
    //     path: "/redirect",
    //     component: Layout,
    //     meta: { hidden: true },
    //     children: [
    //         {
    //             path: "/redirect/:path(.*)",
    //             component: () => import( "@/views/redirect/index.vue" ),

    //         },
    //     ]
    // },

    {
        path: "/login",
        component: () => import( "@/views/login/index.vue" ),
        meta: { hidden: true },
    },

    // {
    //     path: "/",
    //     name: "/",
    //     component: Layout,
    //     redirect: "/dashboard",
    //     children: [
    //         {
    //             path: "dashboard",
    //             component: () => import( "@/views/dashboard/index.vue" ),
    //             meta: {
    //                 title: "dashboard",
    //                 icon: "homepage",
    //                 affix: true,
    //                 keepAlive: true,
    //             },
    //         },
    //         {
    //             path: "401",
    //             component: () => import( "@/views/error/401.vue" ),
    //             meta: { hidden: true },
    //         },
    //         {
    //             path: "404",
    //             component: () => import( "@/views/error/404.vue" ),
    //             meta: { hidden: true },
    //         },
    //         {
    //             path: "profile",
    //             name: "Profile",
    //             component: () => import( "@/views/profile/index.vue" ),
    //             meta: { title: "个人中心", icon: "user", hidden: true },
    //         },
    //         {
    //             path: "my-notice",
    //             name: "MyNotice",
    //             component: () => import( "@/views/system/notice/components/MyNotice.vue" ),
    //             meta: { title: "我的通知", icon: "user", hidden: true },
    //         },
    //     ]
    // }
];

// 创建路由
const router = createRouter( {
    history: createWebHashHistory(),
    routes: constantRoutes,
    // 刷新时，滚动条位置还原
    scrollBehavior: () => ( { left: 0, top: 0 } )
} );

// 全局注册router
export function setupRouter ( app ) {
    app.use( router );
}

export default router;